<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>IIC总线 | ZY&#39;s Blog</title>
  <meta name="keywords" content=" 嵌入式 , IIC ">
  <meta name="description" content="IIC总线 | ZY&#39;s Blog">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="页面未找到！">
<meta property="og:type" content="website">
<meta property="og:title" content="404">
<meta property="og:url" content="http://yoursite.com/404.html">
<meta property="og:site_name" content="ZY&#39;s Blog">
<meta property="og:description" content="页面未找到！">
<meta property="og:locale" content="en_US">
<meta property="article:published_time" content="2020-01-01T03:11:11.000Z">
<meta property="article:modified_time" content="2020-01-12T05:11:14.818Z">
<meta property="article:author" content="ZY">
<meta name="twitter:card" content="summary">


<link rel="icon" href="/img/avatar.jpg">

<link href="/css/style.css?v=1.0.1" rel="stylesheet">

<link href="/css/hl_theme/github.css?v=1.0.1" rel="stylesheet">

<link href="//cdn.bootcss.com/animate.css/3.5.2/animate.min.css" rel="stylesheet">
<link href="//cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">

<script src="//cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script src="/js/jquery.autocomplete.min.js?v=1.0.1" ></script>

<script src="//cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js"></script>
<script>
    hljs.initHighlightingOnLoad();
</script>

<script src="//cdn.bootcss.com/nprogress/0.2.0/nprogress.min.js"></script>



<script src="//cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.min.js" ></script>

<script src="/js/iconfont.js?v=1.0.1" ></script>

<meta name="generator" content="Hexo 4.2.0"></head>
<div style="display: none">
  <input class="theme_disqus_on" value="false">
  <input class="theme_preload_comment" value="false">
  <input class="theme_blog_path" value="">
</div>

<body>
<aside class="nav">
    <div class="nav-left">
        <a href="/" class="avatar_target">
    <img class="avatar" src="/img/avatar.jpg" />
</a>
<div class="author">
    <span>ZY</span>
</div>

<div class="icon">
    
        
        <a title="email" href="mailto:zh.yao@foxmail.com" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-email"></use>
                </svg>
            
        </a>
        
    
        
        <a title="github" href="https://github.com/zhangyaaoo" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-github"></use>
                </svg>
            
        </a>
        
    
        
        <a title="csdn" href="https://blog.csdn.net/QCZTZSWT357" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-csdn"></use>
                </svg>
            
        </a>
        
    
        
        <a title="qq" href="http://wpa.qq.com/msgrd?v=3&uin=357509508&site=qq&menu=yes" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-qq"></use>
                </svg>
            
        </a>
        
    
</div>




<ul>
    <li><div class="all active">全部文章<small>(8)</small></div></li>
    
        
            
            <li><div data-rel="嵌入式">嵌入式<small>(2)</small></div>
                
            </li>
            
        
    
        
            
            <li><div data-rel="Tools">Tools<small>(3)</small></div>
                
            </li>
            
        
    
        
            
            <li><div data-rel="Linux">Linux<small>(1)</small></div>
                
            </li>
            
        
    
        
            
            <li><div data-rel="Hexo">Hexo<small>(2)</small></div>
                
            </li>
            
        
    
</ul>
<div class="left-bottom">
    <div class="menus">
    
    
    
    
    </div>
    <div><a class="about  hasFriend  site_url"  href="/about">关于</a><a style="width: 50%"  class="friends">友链</a></div>
</div>
<input type="hidden" id="yelog_site_posts_number" value="8">
<input type="hidden" id="yelog_site_word_count" value="8.3k">
<div style="display: none">
    <span id="busuanzi_value_site_uv"></span>
    <span id="busuanzi_value_site_pv"></span>
</div>

    </div>
    <div class="nav-right">
        <div class="friends-area">
    <div class="friends-title">
        友情链接
        <i class="back-title-list"></i>
    </div>
    <div class="friends-content">
        <ul>
            
            <li><a target="_blank" href="http://yelog.org/">叶落阁</a></li>
            
        </ul>
    </div>
</div>
        <div class="title-list">
    <form onkeydown="if(event.keyCode === 13){return false;}">
        <input id="local-search-input" class="search" type="text" placeholder="以 in: 开头进行全文搜索" />
        <i class="cross"></i>
        <span>
            <label for="tagswitch">Tags:</label>
            <input id="tagswitch" type="checkbox" style="display: none" />
            <i id="tagsWitchIcon"></i>
        </span>
    </form>
    <div class="tags-list">
    
    <li class="article-tag-list-item">
        <a class="color4">GCC</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">Git</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">嵌入式</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">IIC</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color1">Linux</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">MTD Subsystem</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">dokuwiki</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color2">ubuntu</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">Hexo</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">VIM</a>
    </li>
    
    <div class="clearfix"></div>
</div>

    
    <div id="local-search-result">

    </div>
    
    <nav id="title-list-nav">
        
        <a  class="嵌入式 "
           href="/2019/12/23/GCC-%E5%B8%B8%E7%94%A8%E5%8F%82%E6%95%B0/"
           data-tag="GCC"
           data-author="" >
            <span class="post-title" title="GCC 常用参数">GCC 常用参数</span>
            <span class="post-date" title="2019-12-23 21:08:06">2019/12/23</span>
        </a>
        
        <a  class="Tools "
           href="/2019/12/25/Git-%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4%E8%AE%B0%E5%BD%95/"
           data-tag="Git"
           data-author="" >
            <span class="post-title" title="Git 常用命令记录">Git 常用命令记录</span>
            <span class="post-date" title="2019-12-25 22:33:06">2019/12/25</span>
        </a>
        
        <a  class="嵌入式 "
           href="/2019/12/21/IIC%E6%80%BB%E7%BA%BF/"
           data-tag="嵌入式,IIC"
           data-author="" >
            <span class="post-title" title="IIC总线">IIC总线</span>
            <span class="post-date" title="2019-12-21 23:05:18">2019/12/21</span>
        </a>
        
        <a  class="Linux "
           href="/2019/12/25/Linux-MTD-Subsystem/"
           data-tag="Linux,MTD Subsystem"
           data-author="" >
            <span class="post-title" title="Linux-MTD-Subsystem">Linux-MTD-Subsystem</span>
            <span class="post-date" title="2019-12-25 18:08:18">2019/12/25</span>
        </a>
        
        <a  class="Tools "
           href="/2020/01/13/ubuntu%E4%B8%8A%E6%90%AD%E5%BB%BAdokuwiki/"
           data-tag="dokuwiki,ubuntu"
           data-author="" >
            <span class="post-title" title="ubuntu上搭建dokuwiki">ubuntu上搭建dokuwiki</span>
            <span class="post-date" title="2020-01-13 20:00:38">2020/01/13</span>
        </a>
        
        <a  class="Hexo "
           href="/2019/12/18/hello-world/"
           data-tag="Hexo"
           data-author="" >
            <span class="post-title" title="Hello World">Hello World</span>
            <span class="post-date" title="2019-12-18 19:43:05">2019/12/18</span>
        </a>
        
        <a  class="Tools "
           href="/2020/01/12/%E4%B8%8A%E5%8F%A4%E7%A5%9E%E5%99%A8-VIM/"
           data-tag="VIM"
           data-author="" >
            <span class="post-title" title="上古神器 VIM">上古神器 VIM</span>
            <span class="post-date" title="2020-01-12 10:24:00">2020/01/12</span>
        </a>
        
        <a  class="Hexo "
           href="/2019/12/18/%E5%9F%BA%E4%BA%8E-Hexo-Github-%E6%90%AD%E5%BB%BA%E8%87%AA%E5%B7%B1%E7%9A%84%E5%8D%9A%E5%AE%A2/"
           data-tag="Hexo"
           data-author="" >
            <span class="post-title" title="基于 Hexo &amp; Github 搭建自己的博客">基于 Hexo &amp; Github 搭建自己的博客</span>
            <span class="post-date" title="2019-12-18 19:43:06">2019/12/18</span>
        </a>
        
    </nav>
</div>
    </div>
    <div class="hide-list">
        <div class="semicircle">
            <div class="brackets first"><</div>
            <div class="brackets">&gt;</div>
        </div>
    </div>
</aside>
<div class="post">
    <div class="pjax">
        <article id="post-IIC总线" class="article article-type-post" itemscope itemprop="blogPost">
    
        <h1 class="article-title">IIC总线</h1>
    
    <div class="article-meta">
        
        
        
        <span class="book">
            
                <a  data-rel="嵌入式">嵌入式</a>
            
        </span>
        
        
        <span class="tag">
            
            <a class="color4">嵌入式</a>
            
            <a class="color4">IIC</a>
            
        </span>
        
    </div>
    <div class="article-meta">
        
        创建时间:<time class="date" title='更新时间: 2020-04-25 22:35:37'>2019-12-21 23:05</time>
        
    </div>
    <div class="article-meta">
        
        <span>字数:1.9k</span>
        
        
        <span id="busuanzi_container_page_pv">
            阅读:<span id="busuanzi_value_page_pv">
                <span class="count-comment">
                    <span class="spinner">
                      <div class="cube1"></div>
                      <div class="cube2"></div>
                    </span>
                </span>
            </span>
        </span>
        
        
    </div>
    
    <div class="toc-ref">
    
        <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#IIC总线上的三种信号类型"><span class="toc-text">IIC总线上的三种信号类型</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#开始和结束信号"><span class="toc-text">开始和结束信号</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#应答信号"><span class="toc-text">应答信号</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#一个字节的传输"><span class="toc-text">一个字节的传输</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#IIC协议内容"><span class="toc-text">IIC协议内容</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#SDA-SCL线如何输出高低电平"><span class="toc-text">SDA&#x2F;SCL线如何输出高低电平</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#拉低"><span class="toc-text">拉低</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#拉高"><span class="toc-text">拉高</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#SDA、SCL线上的上拉电阻"><span class="toc-text">SDA、SCL线上的上拉电阻</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#一次完整的传输"><span class="toc-text">一次完整的传输</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#总线的状态"><span class="toc-text">总线的状态</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#空闲状态"><span class="toc-text">空闲状态</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#忙碌状态"><span class="toc-text">忙碌状态</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#实际波形分析"><span class="toc-text">实际波形分析</span></a></li></ol>
    
<style>
    .left-col .switch-btn,
    .left-col .switch-area {
        display: none;
    }
    .toc-level-3 i,
    .toc-level-3 ol {
        display: none !important;
    }
</style>
</div>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p><a href="http://www.ti.com/lit/an/slva704/slva704.pdf" target="_blank" rel="noopener">资料来源</a></p>
<h2 id="IIC总线上的三种信号类型"><a href="#IIC总线上的三种信号类型" class="headerlink" title="IIC总线上的三种信号类型"></a>IIC总线上的三种信号类型</h2><h3 id="开始和结束信号"><a href="#开始和结束信号" class="headerlink" title="开始和结束信号"></a>开始和结束信号</h3><p><img src="https://gitee.com/zhangyaaoo/blogpics/raw/master/iic/iic-start-stop.png" alt="iic-start-stop"></p>
<h3 id="应答信号"><a href="#应答信号" class="headerlink" title="应答信号"></a>应答信号</h3><p><img src="https://gitee.com/zhangyaaoo/blogpics/raw/master/iic/iic-ack.png" alt="iic-ack"></p>
<h3 id="一个字节的传输"><a href="#一个字节的传输" class="headerlink" title="一个字节的传输"></a>一个字节的传输</h3><p><img src="https://gitee.com/zhangyaaoo/blogpics/raw/master/iic/iic-single-byte-transfer.jpg" alt="iic-single-byte-transfer"></p>
<blockquote>
<p>看着这样的时序图的时候，有一个暗线：时间。既然叫“时序图”，那么时间是隐藏在图中的很重要变量，</p>
</blockquote>
<p><img src="https://gitee.com/zhangyaaoo/blogpics/raw/master/iic/iic-single-byte-transfer-t.png" alt="iic-single-byte-transfer-t"></p>
<p><strong>所以从左到右，随着时间的流逝，首先发送的数据是MSB，最后发送的是LSB。</strong></p>
<h2 id="IIC协议内容"><a href="#IIC协议内容" class="headerlink" title="IIC协议内容"></a>IIC协议内容</h2><p>首先区分下面几个名词</p>
<ul>
<li>MASTER (主机)</li>
<li>SLAVE (从机)</li>
<li>TRANSMITTER (发送方)</li>
<li>RECEIVER (接收方)</li>
</ul>
<p>==协议要求：==</p>
<ol>
<li>开始和结束信号只能由主机发送。</li>
<li>应答信号由数据接收方发送，数据接收方可以是主机，也可以是从机。</li>
<li>SCL上的时钟信号始终都是由主机发送的。</li>
<li>在传输数据时：SDA上传输的数据必须在SCL为高电平期间保持稳定，SDA上的数据只能在SCL为低电平期间变化。在SCL为高电平期间改变SDA上的数据将被视为开始或者结束信号。</li>
<li>IIC传输的字节必须是8位。每个字节传输后都要跟随一个应答信号。对每次数据传输的字节数没有严格限制。</li>
<li>先发送高位字节(MSB)。</li>
</ol>
<h2 id="SDA-SCL线如何输出高低电平"><a href="#SDA-SCL线如何输出高低电平" class="headerlink" title="SDA/SCL线如何输出高低电平"></a>SDA/SCL线如何输出高低电平</h2><h3 id="拉低"><a href="#拉低" class="headerlink" title="拉低"></a>拉低</h3><p><img src="https://gitee.com/zhangyaaoo/blogpics/raw/master/iic/iic-pulling-down.jpg" alt="iic-pulling-down"></p>
<p><strong>当主机或从机想输出一个低电平，通过使FET导通，将引脚线接地，输出一个低电平。</strong></p>
<p>The logic wanting to transmit a low will activate the pull-down FET, which will provide a short to ground, pulling the line low.</p>
<h3 id="拉高"><a href="#拉高" class="headerlink" title="拉高"></a>拉高</h3><p><img src="https://gitee.com/zhangyaaoo/blogpics/raw/master/iic/iic-release-high.jpg" alt="iic-release-high"></p>
<p><strong>当主机或从机想输出一个高电平(只能通过释放总线)，通过使FET截止，将引脚线悬空，由于上拉电阻的作用，引脚将输出一个高电平。</strong></p>
<p>When the slave or master wishes to transmit a logic high, it may only release the bus by turning off the pull-down FET. This leaves the bus floating, and the pull-up resistor will pull the voltage up to the voltage rail, which will be interpreted as a high. The figure shows the flow of current through the pull-up resistor, which pulls the bus high.</p>
<h3 id="SDA、SCL线上的上拉电阻"><a href="#SDA、SCL线上的上拉电阻" class="headerlink" title="SDA、SCL线上的上拉电阻"></a>SDA、SCL线上的上拉电阻</h3><p><img src="https://gitee.com/zhangyaaoo/blogpics/raw/master/iic/iic-pin-internal.jpg" alt="iic-pin-internal"></p>
<p>最近，一些工程师在处理IIC单片机接口的工作问题时，对外部接上拉电阻的做法感到疑惑。由于单片机内部已经设置了上拉电阻，对于外部是否还需要接上拉的情况业界一直存在争议。针对I2C是否有必要接上拉的问题，就让牛人来为我们进行深入解读。</p>
<p>由于一些单片机型号内部就设置了上拉电阻，因此有些上拉能力够了，是可以不加上拉电阻，有些不够，那就必须在外部加上拉电阻。在这种情况下，主要是取决于工程师所使用的单片机是否有标准的IIC标准接口。如果单片机使用了标准的IIC接口，那么接口在使能时引脚将进入漏极开路模式，可以省去外部接入的上拉电阻。但如果是使用单片机的引脚模拟IIC协议的话，就需要结合单片机引脚是否支持漏极开路模式或者上拉模式来进行判断，这种情况下一般是需要接入一个外部的上拉电阻的。</p>
<p>除此之外，在IIC接口接入上拉电阻，也可以起到保护作用。由于I2C接口在工作时主要负责的是对高低电平检测的作用，一旦没有了上拉电阻的保护而直接接电源，出现器件拉低时整个系统就非常危险。根据I2C总线规范，总线空闲时两根线都必须为高。根据IIC总线规范的要求，总线空闲时两根线都必须为高。但由于IIC接口采用Open Drain机制，本身只能输出低电平而无法主动输出高电平，所以只能通过外部上拉电阻RP将信号线拉至高电平。因此I2C总线上的上拉电阻是必须要接入的。</p>
<p>结语</p>
<p>工程师需要依据IIC接口的具体情况，判断是否有必要在外部单独接入一个上拉电阻。如果没有使用标准的I2C接口，为了系统的稳定和安全，在外部进行上拉电阻的接入就是必须的工作了。<a href="https://www.dianyuan.com/article/30297.html" target="_blank" rel="noopener">摘抄自这里</a></p>
<h2 id="一次完整的传输"><a href="#一次完整的传输" class="headerlink" title="一次完整的传输"></a>一次完整的传输</h2><p><img src="https://gitee.com/zhangyaaoo/blogpics/raw/master/iic/iic-data-transfer.jpg" alt="iic-data-transfer"><br>主机发送开始信号后，随后发送7-bit的从机地址，第8位发送读写位，读写位标志着：主机接下来是写数据到从设备，还是从从设备读数据。</p>
<p>然后，<strong>主机释放SDA线 (释放以后，由于上拉电阻的作用，SDA线上的电平状态被上拉电阻拉高)，等待从设备的应答</strong>。每一个字节的数据传送完成后都会有一个位的应答。</p>
<p>应答时：从机将SDA线上的电平拉低，并在第9个时钟周期SCL为高电平时一直保持拉低状态，保证主机能够正常读取从机的应答。</p>
<p><strong>发送开始信号后，可以不发送结束信号，再一次发送开始信号。</strong></p>
<p><img src="https://gitee.com/zhangyaaoo/blogpics/raw/master/iic/iic-writemode-7-addr.jpg" alt="iic-writemode-7-addr"></p>
<p><strong>主机读写从机寄存器中的数值：</strong><br><img src="https://gitee.com/zhangyaaoo/blogpics/raw/master/iic/iic-single-byte-write.jpg" alt="iic-single-byte-write"></p>
<p><img src="https://gitee.com/zhangyaaoo/blogpics/raw/master/iic/iic-single-byte-read.jpg" alt="iic-single-byte-read"><br>==注意==：主机接收器在接收到最后一个字节后，不会发出ACK信号。于是从机释放SDA线，以允许主机发出P信号结束传输. </p>
<p><img src="https://gitee.com/zhangyaaoo/blogpics/raw/master/iic/iic-read-register.jpg" alt="iic-read-register"></p>
<hr>
<p>为什么向从机寄存器写数据时，不需要重新发送开始信号，而从从机寄存器读数据时，需要重新发送开始信号？</p>
<p>在发送开始信号后，主机需要发送从机地址和读写位，可以认为读写位规定了这次开始传输的数据流向，写：表示数据由主机给出，从机接收数据；读：表示数据由从机给出，主机接收数据。</p>
<p>当向从机寄存器写数据时，数据的流向一直是从主机流向从机；</p>
<p>当从从机寄存器读数据时，我们首先需要向从机给出寄存器地址，然后从机给主机发送寄存器中的值，数据的流向所有改变，所以我们需要在向从机写入寄存器地址后，重新发送开始信号，此时读写位为1，指明接下来从机发送数据给主机。</p>
<hr>
<h2 id="总线的状态"><a href="#总线的状态" class="headerlink" title="总线的状态"></a>总线的状态</h2><h3 id="空闲状态"><a href="#空闲状态" class="headerlink" title="空闲状态"></a>空闲状态</h3><p>SDA、SCL都为高电平，开始信号发出前，结束信号发出后。</p>
<h3 id="忙碌状态"><a href="#忙碌状态" class="headerlink" title="忙碌状态"></a>忙碌状态</h3><p>开始信号发出后，结束信号发出前都视为忙碌状态。</p>
<h2 id="实际波形分析"><a href="#实际波形分析" class="headerlink" title="实际波形分析"></a>实际波形分析</h2><p><img src="https://gitee.com/zhangyaaoo/blogpics/raw/master/iic/iic-real-wave.jpg" alt="iic-real-wave"><strong>上图是一个实际的IIC传输的波形.(黄色:SCL 绿色:SDA)</strong></p>
<p><img src="https://gitee.com/zhangyaaoo/blogpics/raw/master/iic/iic-real-wave-one-byte.jpg" alt="iic-real-wave-one-byte"><br><strong>实际的波形和上面理论分析的波形有所不同，不同的地方是</strong>: SDA线上的数据是在时钟负跳变时几乎马上输出的，如序号2和3标记的地方。但是这个符合：SDA上传输的数据必须在SCL为高电平期间保持稳定，SDA上的数据只能在SCL为低电平期间变化。</p>
<ul>
<li>数据传输起始信号,(序号1标记的地方): 时钟为高时,数据线上电平的负跳变.</li>
<li>数据传输过程中,时钟为高时,数据线上保持电平稳定. 如序号4和5标记的地方.</li>
<li>起始位(6)，地址传输(7)，读写位(8)，应答(9)</li>
</ul>
<p><img src="https://gitee.com/zhangyaaoo/blogpics/raw/master/iic/iic-real-wave-parse.jpg" alt="iic-real-wave-parse"></p>

      
       <hr><span style="font-style: italic;color: gray;"> 转载请注明来源，欢迎对文章中的内容批评指正. 可以邮件至 zh.yao@foxmail.com </span>
    </div>
</article>



<div class="article_copyright">
    <p><span class="copy-title">文章标题:</span>IIC总线</p>
    <p><span class="copy-title">文章字数:</span><span class="post-count">1.9k</span></p>
    <p><span class="copy-title">本文作者:</span><a  title="ZY">ZY</a></p>
    <p><span class="copy-title">发布时间:</span>2019-12-21, 23:05:18</p>
    <p><span class="copy-title">最后更新:</span>2020-04-25, 22:35:37</p>
    <span class="copy-title">原始链接:</span><a class="post-url" href="/2019/12/21/IIC%E6%80%BB%E7%BA%BF/" title="IIC总线">http://yoursite.com/2019/12/21/IIC%E6%80%BB%E7%BA%BF/</a>
    <p>
        <span class="copy-title">版权声明:</span><i class="fa fa-creative-commons"></i> <a rel="license noopener" href="http://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank" title="CC BY-NC-SA 4.0 International" target = "_blank">"署名-非商用-相同方式共享 4.0"</a> 转载请保留原文链接及作者。
    </p>
</div>





    




    </div>
    <div class="copyright">
        <p class="footer-entry">©2016-2020 ZY</p>
<p class="footer-entry">Built with <a href="https://hexo.io/" target="_blank">Hexo</a> and <a href="https://github.com/yelog/hexo-theme-3-hexo" target="_blank">3-hexo</a> theme</p>

    </div>
    <div class="full-toc">
        <button class="full"><span class="min "></span></button>
<button class="post-toc-menu"><span class="post-toc-menu-icons"></span></button>
<div class="post-toc"><span class="post-toc-title">目录</span>
    <div class="post-toc-content">

    </div>
</div>
<a class="" id="rocket" ></a>

    </div>
</div>
<div class="acParent"></div>

</body>
<script src="/js/jquery.pjax.js?v=1.0.1" ></script>

<script src="/js/script.js?v=1.0.1" ></script>
<script>
    var img_resize = 'default';
    /*作者、标签的自动补全*/
    $(function () {
        $('.search').AutoComplete({
            'data': ['#GCC','#Git','#嵌入式','#IIC','#Linux','#MTD Subsystem','#dokuwiki','#ubuntu','#Hexo','#VIM',],
            'itemHeight': 20,
            'width': 418
        }).AutoComplete('show');
    })
    function initArticle() {
        /*渲染对应的表格样式*/
        

        /*渲染打赏样式*/
        

        /*高亮代码块行号*/
        
        $('pre code').each(function(){
            var lines = $(this).text().trim().split('\n').length, widther='';
            if (lines>99) {
                widther = 'widther'
            }
            var $numbering = $('<ul/>').addClass('pre-numbering ' + widther).attr("unselectable","on");
            $(this).addClass('has-numbering ' + widther)
                    .parent()
                    .append($numbering);
            for(var i=1;i<=lines;i++){
                $numbering.append($('<li/>').text(i));
            }
        });
        

        /*访问数量*/
        
        $.getScript("//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js");
        

        /*代码高亮，行号对齐*/
        $('.pre-numbering').css('line-height',$('.has-numbering').css('line-height'));

        
        
    }

    /*打赏页面隐藏与展示*/
    

</script>

<!--加入行号的高亮代码块样式-->

<style>
    pre{
        position: relative;
        margin-bottom: 24px;
        border-radius: 10px;
        border: 1px solid #e2dede;
        background: #FFF;
        overflow: hidden;
    }
    code.has-numbering{
        margin-left: 30px;
    }
    code.has-numbering.widther{
        margin-left: 35px;
    }
    .pre-numbering{
        margin: 0px;
        position: absolute;
        top: 0;
        left: 0;
        width: 20px;
        padding: 0.5em 3px 0.7em 5px;
        border-right: 1px solid #C3CCD0;
        text-align: right;
        color: #AAA;
        background-color: ;
    }
    .pre-numbering.widther {
        width: 35px;
    }
</style>

<!--自定义样式设置-->
<style>
    
    
    .nav {
        width: 542px;
    }
    .nav.fullscreen {
        margin-left: -542px;
    }
    .nav-left {
        width: 120px;
    }
    
    
    @media screen and (max-width: 1468px) {
        .nav {
            width: 492px;
        }
        .nav.fullscreen {
            margin-left: -492px;
        }
        .nav-left {
            width: 100px;
        }
    }
    
    
    @media screen and (max-width: 1024px) {
        .nav {
            width: 492px;
            margin-left: -492px
        }
        .nav.fullscreen {
            margin-left: 0;
        }
        .nav .hide-list.fullscreen {
            left: 492px
        }
    }
    
    @media screen and (max-width: 426px) {
        .nav {
            width: 100%;
        }
        .nav-left {
            width: 100%;
        }
    }
    
    
    .nav-right .title-list nav a .post-title, .nav-right .title-list #local-search-result a .post-title {
        color: #383636;
    }
    
    
    .nav-right .title-list nav a .post-date, .nav-right .title-list #local-search-result a .post-date {
        color: #5e5e5f;
    }
    
    
    .nav-right nav a.hover, #local-search-result a.hover{
        background-color: #e2e0e0;
    }
    
    

    /*列表样式*/
    

    /* 背景图样式 */
    
    


    /*引用块样式*/
    

    /*文章列表背景图*/
    
    .nav-right:before {
        content: ' ';
        display: block;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        opacity: 0.3;
        background: url("https://i.loli.net/2019/07/22/5d3521411f3f169375.png");
        background-repeat: no-repeat;
        background-position: 50% 0;
        -ms-background-size: cover;
        -o-background-size: cover;
        -moz-background-size: cover;
        -webkit-background-size: cover;
        background-size: cover;
    }
    

    
    .post .pjax article :not(pre) > code {
        color: #24292e;
        font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;
        background-color: rgba(27,31,35,.05);
        border-radius: 3px;
        font-size: 85%;
        margin: 0;
        padding: .2em .4em;
    }
    
</style>







</html>
